package com.hbnu.list;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class HashSetDemo {
    public static void main(String[] args) {
        Set<String> names = new HashSet<>();


        names.add("moon");
        names.add("John");
        names.add("Wick");

        System.out.println(names);

        System.out.println(names.isEmpty());
        System.out.println(names.size());

        for (String name:names){
            System.out.println(name);
        }

        Iterator<String> iterator = names.iterator();
        System.out.println(iterator);
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
    }
}




